<template>
  <div class="container">
      <div class="item" v-for="item of data" :key="item._id">
          <img class="item_img" @click="handleDetail(item._id)" :src="item.pic" alt="">
          <p>{{item.title}}</p>
     
          <div class="footer">
          <div class="car" v-for="(value,index) of item.count" :key="index">
                  <img  v-if="value>=1.5" src="../images/star.png" alt="">
                  <img  v-else-if="value>=0.5" src="../images/baba.png" alt="">
                  <img  v-else src="../images/chat.png" alt="">
          </div>
          <p>{{item.rating}}{{item.raiting}}</p>
          </div>
      </div>
  </div>
</template>

<script>
export default {
    data(){
        return{
            arr:[]
        }
    },
    methods:{
        handleDetail(id){
          this.$router.push(`/movieDetail?id=${id}`)
        }
    },
    props:['data']
}
</script>

<style scoped>
  .car img{
    width: 30px;
  }
.container{
    width: 10rem; 
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
.item{
    width: 2.9333rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.item_img{
    width: 2.9333rem;
    height: 2.9333rem;
}
.footer{
    display: flex;
    justify-content: space-between;
    align-items: center;
}
</style>